from bs4 import BeautifulSoup

with open('page1.html', 'rb') as page1:
    soup = BeautifulSoup(page1, 'lxml')

# 标准格式化输出网页代码
# print(soup.prettify())

# 打印title
# print(soup.title.string)

# 打印title的父亲节点
# print(soup.title.parent)

# 找第一个h2内容
print(soup.h2.string)

# 找到所有h2内容
# for h2 in soup.findAll('span'):
#     print(h2.string)

# print(soup.find('h2', {'class': 'm-b-sm'}))

# 找所有的电影封面
for img in soup.findAll('img'):
    # url = img.get('src')
    print(img.children)